

using System;
using OpenViewer.Models;
using OpenViewer.Render;
using ThirdLife.Render.MogrePlugin.Common;

namespace ThirdLife.Render.MogrePlugin
{
  public class ThirdLifeRenderPlugin : IRenderingEngine
  {
    private IRenderingEngineController _controller;

    public ThirdLifeRenderPlugin()
    {
      
    }

    public string GetName()
    {
      return "ThirdLife";
    }

    public void Initialize(Model model, IntPtr handle, int width, int height)
    {
      _controller = new RenderingEngineController(new UserControlRenderingView(handle, width, height), new MetaverseModel(model));
      _controller.Setup();
    }

    public void Run()
    {
      _controller.StartRendering();
    }

    public void Stop()
    {
      _controller.StopRendering();
    }

    public int MoveCamera
    {
      get { return _controller.ActiveCamera.Move; }
      set { _controller.ActiveCamera.Move = value; }
    }

    public int CameraPitch
    {
      get { return _controller.ActiveCamera.Pitch; }
      set { _controller.ActiveCamera.Pitch = value; }
    }

    public int CameraYaw
    {
      get { return _controller.ActiveCamera.Yaw; }
      set { _controller.ActiveCamera.Yaw = value; }
    }
  }
}